<template>
	<view>

		<!-- 钱包弹出框 -->
		<view class="topup-wallet-modal-container" v-if="walletOpen">
			<view class="topup_container ios">
				<view class="topup-box-wrap">
					<view class="topup-close-btn" @click="closeModel"></view>
					<view class="topup-overflow-hidden">
						<view class="topup-box" device="ios">
						

							<view class="topup-content">
								<view class="topup_step1_wrap">
									<view class="content_header content_headers">
										<view class="header">我的资产</view>
										<view class="balance_header">
											<view class="desc">{{$t('my')}}RHD总资产</view>
											<view class="balance_input">
												<view>
													<text class="txt">{{amount}}</text>
												</view>
											</view>

										</view>

										<view class="wallet_content mab-40">
											<view class="wallet_content_title bnone">
												提现金额{{$t('money')}}
											</view>
											<view>
												<input type="number" v-model="outmoney" class="up-money-input">
											</view>
										</view>
										<view class="wallet_bottom mab-40" :class="select_btn?'':'disabled_btn'">

											<view class="send" v-if="select_btn">
												<view v-if="!isloading" @click="apply()">
													提现申请
												</view>
												<view v-else class="wallet_loadings" disabled>
													提现申请
												</view>
											</view>
											<view class="send disabled_btn" v-else>
												<view>
													提现申请
												</view>
											</view>
										</view>
										<view class="bottom_desc">
											提现需消耗25%的GAS费
										</view>
									</view>
								</view>
							</view>
							
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	const copys = require("@/components/common/tui-clipboard/tui-clipboard.js")
	import yui from '@/common/httpRequest';
	import web3 from '@/common/web3Rpc.js';
	export default {
		name: 'walletRhdPop',
		props: {
			//是否固定
			walletOpen: {
				type: Boolean,
				default: false
			},
			amount:{
				type: Number,
				default: 0
			}
			
		},
		mounted() {
			
			this.address = yui.hidden(uni.getStorageSync("yy_wallet").address, 6, 6)
			
		},
		data() {
			return {
				amount: '0.00',
				wallet_modal_box: false,
				wallet_modal_box2: false,
				address: '',
				subIndex: [],

				indexs: 0,
				select_btn: true,
				outmoney: '',
				walletData: [],
				isloading: false,
				rhdamount: 0,
				types: 1,

			};
		},
		methods: {
			
			closeModel() {
				this.$emit('closeWallet');
				
				this.isloading = false;
			},
			
			apply() {
				if (this.isloading) {
					return;
				}
				this.isloading = true;
				let datas={amount:this.outmoney}
				let walletData = this.tui.request('/api/user/withdraw', 'post',datas, 1000, 1, '', 'withdraw');
				Promise.resolve(walletData).then((value) => {
					if (value.code == 200) {
					    
						this.$emit('showTips', '申请成功', 'green');
						this.closeModel();
						this.isloading = false
					}else{
						this.$emit('showTips', value.message, 'warning');
						this.isloading = false
					}
				})

			},
			
		}
	};
</script>

<style scoped>
	@import '../../static/css/defalut.css';

	.tui-tabs-view {
		width: 100%;
		border-radius: 14rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.tui-tabs-relative {
		position: relative;
	}

	.up-money-input {
		border: 2rpx solid #575454;
		padding: 16rpx 60rpx;
		text-align: center;
		border-radius: 10rpx;
	}

	.bottom_desc {

		width: 100%;
		font-size: 24rpx;
		height: 20%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		margin-bottom: 24rpx;
		color: #929398;
	}

	.yui-tab-title-clove {}

	.yui-tabs-tags {
		display: block;
		margin-top: 4rpx;
		text-align: center;
		font-size: 24rpx;
	}

	.tui-tabs-fixed {
		position: fixed;
		left: 0;
	}

	.tui-tabs-fixed::before,
	.tui-tabs-relative::before {
		content: '';
		position: absolute;
		border-bottom: 1rpx solid #eaeef1;
		-webkit-transform: scaleY(0.5) translateZ(0);
		transform: scaleY(0.5) translateZ(0);
		transform-origin: 0 100%;
		bottom: 0;
		right: 0;
		left: 0;
	}

	.tui-unlined::before {
		border-bottom: 0 !important;
	}

	.tui-tabs-item {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.tui-tabs-disabled {
		opacity: 0.6;
	}

	.tui-tabs-title {
		/* 	display: flex;
	align-items: center;
	justify-content: center; */
		text-align: center;
		position: relative;
		z-index: 2;
	}

	.tui-tabs-active {
		transition: all 0.15s ease-in-out;
	}

	.tui-tabs-slider {
		position: absolute;
		left: 0;
		transition: all 0.15s ease-in-out;
		z-index: 0;
		transform: translateZ(0);
	}
</style>